// 收货地址封装API接口
import request from '@/utils/request'
// 获取地址列表
export const getAddressList = () => {
  return request.get('/address/list')
}

// 添加收获地址
export const addAddress = (form) => {
  return request.post('/address/add', {
    form
  })
}

// 获取省市区地址
export const getAreaList = () => {
  return request.get('/region/tree')
}
// 获取收货地址详情
export const getAddressDetail = (addressId) => {
  return request.get('/address/detail', { params: addressId })
}

// 默认收货地址
export const defaultAddress = () => {
  return request.get('/address/defaultId')
}

// 设置默认地址
export const setDefaultAddress = (addressId) => {
  return request.post('/address/setDefault', { addressId })
}

// 编辑收货地址
export const editAddress = (addressId, form) => {
  return request.post('/address/edit', {
    addressId,
    form
  })
}

// 删除收货地址
export const removeAddress = (addressId) => {
  return request.post('/address/remove', { addressId: addressId })
}
